home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / WIN / VB_DB / PROFIT.ZIP / CVMAIN.BAS < prev    next >
Encoding:
BASIC Source File  |  1993-03-14  |  5.1 KB  |  160 lines

  1. ' ********************************************************
  2. ' *       GLOBAL DECLARATIONS                            *
  3. ' ********************************************************
  4.     Global SavedPointer As Integer
  5.     Global PrintCancelFlag As Integer
  6.     Global ReportSelection As Integer
  7.     Global ActiveTransaction As Integer
  8.  
  9.     Global Const KEY_LEFT = &H25
  10.     Global Const KEY_UP = &H26
  11.     Global Const KEY_RIGHT = &H27
  12.     Global Const KEY_DOWN = &H28
  13.     Global Const KEY_PAGE_UP = &H21
  14.     Global Const KEY_PAGE_DOWN = &H22
  15.     Global Const KEY_F1 = &H70
  16.     Global Const KEY_F2 = &H71
  17.     Global Const KEY_F3 = &H72
  18.     Global Const KEY_F4 = &H73
  19.     Global Const KEY_F5 = &H74
  20.     Global Const KEY_F6 = &H75
  21.     Global Const KEY_F7 = &H76
  22.     Global Const KEY_F8 = &H77
  23.     
  24. 'Fonts Dialog Flags
  25.     Global Const CF_SCREENFONTS = &H1&
  26.     Global Const CF_PRINTERFONTS = &H2&
  27.     Global Const CF_BOTH = &H3&
  28.     Global Const CF_SHOWHELP = &H4&
  29.     Global Const CF_INITTOLOGFONTSTRUCT = &H40&
  30.     Global Const CF_USESTYLE = &H80&
  31.     Global Const CF_EFFECTS = &H100&
  32.     Global Const CF_APPLY = &H200&
  33.     Global Const CF_ANSIONLY = &H400&
  34.     Global Const CF_NOVECTORFONTS = &H800&
  35.     Global Const CF_NOSIMULATIONS = &H1000&
  36.     Global Const CF_LIMITSIZE = &H2000&
  37.     Global Const CF_FIXEDPITCHONLY = &H4000&
  38.     Global Const CF_WYSIWYG = &H8000&                        'must also have CF_SCREENFONTS & CF_PRINTERFONTS
  39.     Global Const CF_FORCEFONTEXIST = &H10000
  40.     Global Const CF_SCALABLEONLY = &H20000
  41.     Global Const CF_TTONLY = &H40000
  42.     Global Const CF_NOFACESEL = &H80000
  43.     Global Const CF_NOSTYLESEL = &H100000
  44.     Global Const CF_NOSIZESEL = &H200000
  45.     
  46.     
  47.     Global Const BOPEN = 0
  48.     Global Const BCLOSE = 1
  49.     Global Const BINSERT = 2
  50.     Global Const BUPDATE = 3
  51.     Global Const BDELETE = 4
  52.     Global Const BNEXT = 6
  53.     Global Const BPREVIOUS = 7
  54.     Global Const BFIRST = 12
  55.     Global Const BLAST = 13
  56.     Global Const BEQUAL = 5
  57.     Global Const BBEGTRANS = 19
  58.     Global Const BABOTRANS = 21
  59.     Global Const BENDTRANS = 20
  60.     Global Const BGETGE = 9
  61.  
  62. 'Printer orientation
  63.  
  64.     Type ORIENT
  65.       Orientation As Long
  66.       Pad As String * 16
  67.     End Type
  68.     Declare Function PrtOrient% Lib "GDI" Alias "Escape" (ByVal hDc%, ByVal nEsc%, ByVal nLen%, lpData As ORIENT, lpOut As Any)
  69.   
  70.     Global prtO As ORIENT
  71.  
  72. 'Configuration file layout
  73.  
  74.     Type CfgType
  75.       PrintOptNumber As Integer
  76.       FontName       As String * 80
  77.       FontSize       As Integer
  78.       TopMargin      As Integer
  79.       LeftMargin     As Integer
  80.       LabelWidth     As Integer
  81.       LabelHeight    As Integer
  82.       LabelRows      As Integer
  83.       LabelColumns   As Integer
  84.       DescriptionX   As Integer
  85.       DescriptionY   As Integer
  86.       DescriptionFS  As Integer
  87.       RecipeNoX      As Integer
  88.       RecipeNoY      As Integer
  89.       RecipeNoFS     As Integer
  90.       PriceX         As Integer
  91.       PriceY         As Integer
  92.       PriceFS        As Integer
  93.       ShelfLifeX     As Integer
  94.       ShelfLifeY     As Integer
  95.       ShelfLifeFS    As Integer
  96.       LandPortFlag   As Integer
  97.       ToolBar        As Integer
  98.     End Type
  99.  
  100.     Global CfgRec As CfgType
  101.  
  102.     Type WorkType
  103.       RecNo       As String * 6
  104.       Description As String * 30
  105.       Price       As String * 5
  106.       ShelfLife   As String * 3
  107.     End Type
  108.  
  109.     Global WorkRec As WorkType
  110.    
  111.    '****************************************************************
  112.    '*   Position Block user defined type                           *
  113.    '****************************************************************
  114.  
  115.     Type PosBlk
  116.       PBelements As String * 128
  117.     End Type
  118.  
  119.     '**********************************************************************
  120.     '*    Declare btrieve calls                                           *
  121.     '**********************************************************************
  122.  
  123.     Declare Function WBtrvInit Lib "wbtrcall.dll" (ByVal init$) As Integer
  124.     Declare Function WBtrvStop Lib "wbtrcall.dll" () As Integer
  125.     Declare Function btrcall Lib "wbtrcall.dll" (ByVal op%, Pb As PosBlk, Db As Any, Dl As Integer, ByVal Kb$, ByVal Kl%, ByVal Kn%) As Integer
  126.  
  127. Sub AbortTransaction ()
  128.     KeyBufLen% = 255
  129.     BufLen% = 1
  130.     KeyNum% = 0
  131.     St% = 0
  132.     St% = btrcall(BABOTRANS, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  133.     ActiveTransaction = False
  134.  
  135. End Sub
  136.  
  137. Sub BeginTransaction ()
  138.     KeyBufLen% = 255
  139.     BufLen% = 1
  140.     KeyNum% = 0
  141.     St% = 0
  142.     St% = btrcall(BBEGTRANS, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  143.     ActiveTransaction = True
  144.     If St% <> 0 Then
  145.       Msg$ = "Transaction Begin failed. Status = " + Str$(St%)
  146.       T1% = MsgBox(Msg$, 0, "Warning!")
  147.     End If
  148.  
  149. End Sub
  150.  
  151. Sub EndTransaction ()
  152.     KeyBufLen% = 255
  153.     BufLen% = 1
  154.     KeyNum% = 0
  155.     St% = 0
  156.     St% = btrcall(BENDTRANS, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  157.     ActiveTransaction = False
  158. End Sub
  159.  
  160.